package com.whjfxx.terminal.controller;

import com.whjfxx.terminal.base.BaseController;
import com.whjfxx.terminal.biz.service.ResourceService;
import com.whjfxx.terminal.biz.service.UserService;
import com.whjfxx.terminal.biz.vo.MenuInfoVo;
import com.whjfxx.terminal.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by b.c on 2022/4/27 16:20
 */
@RestController
@RequestMapping("resource")
public class ResourceController extends BaseController {

    @Autowired
    ResourceService resourceService;

    @Autowired
    UserService userService;

    @GetMapping("menu-info")
    public MenuInfoVo getMenuInfo() {
        Long userId = getUserId();
        User user = userService.getById(userId);
        MenuInfoVo menuInfoVo = resourceService.getMenuInfoVo(user);
        return menuInfoVo;
    }

}
